package com.example.lianxirenlist;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Edit extends AppCompatActivity {
ListShuJuKu helder;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit);
        intiview();
    }
    public void intiview(){
        EditText editText=findViewById(R.id.edit_user_phone);
        EditText editText1=findViewById(R.id.edit_user_phone1);
        EditText editText2=findViewById(R.id.edit_user_phone2);
        Button button=findViewById(R.id.butt_edit_finish);
        helder = new ListShuJuKu(this, "Persion", null, 1);
        Intent intent=getIntent();
        String name=intent.getStringExtra("name");
        String call=intent.getStringExtra("call");
        String tel=intent.getStringExtra("tel");
        String id=intent.getStringExtra("id");
        editText.setText(name);
        editText1.setText(call);
        editText2.setText(tel);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name=editText.getText().toString();
                helder.updateuser(id,name);
                String call=editText1.getText().toString();
                String tel=editText2.getText().toString();
                helder.updatephone(id,call,tel);
                Intent intent1=new Intent(Edit.this,MainActivity.class);
                startActivity(intent1);
            }
        });
    }
}